// FImageManager.cpp (c) 2011 JV Software
//

#include "EnginePrivate.h"
#include "FImageManagerLocal.h"

FImageManagerLocal	imageManagerLocal;
ENGINE_API FImageManager	*imageManager = &imageManagerLocal;

/*
===============
FImageManagerLocal::LoadImage
===============
*/
FTexture*	FImageManagerLocal::LoadImage( FString path ) {
	FTexture *texture;
	
	// Check to see if the image was already loaded.
	for( int i = 0; i < images.size(); i++ ) {
		if(images[i]->GetName() == path) {
			return images[i];
		}
	}

	// Image isn't loaded, we need to load it now.
	texture = graphicsDevice->LoadImage( path );
	if(!texture) {
		return NULL;
	}

	images.Append( texture );
	return texture;
}